/********************************************************
  *      Real Time Clock DS1307 Library for 18F4620     *
  *                  (for PIC IC.)                      *
  *                 by Deniz ELMASLI                    *
  * Version 2.0                                         *
  * Creation Date: 28.12.2008   -   10:12 Friday        *
  * Revision Date: 08.06.2008   -   03:42 Saturday      *
  * Ide(s) : Code::Blocks v1.0 (C++ developement)       *
  *          MikroC V7.0                                *
  * Target Platform: PIC                                *
  * MCU : 18F4620                                       *
  * Contact: elmasli@gmail.com                          *
  * Web    : www.dronology.com                          *
  *                                                     *
  *   This code in intended to work with PIC IC. This   *
  * source code contains functions to drive DS1307 real *
  * time clock  . I2C Functions used in ver2.0          *
  *******************************************************

*/
 #include "RFRemoteDecode.h"
  /*****************************************************************************
 *                         RFRemoteDecode_GetAddr()
 * Description    :
 * Argument       :
 * Return
 * Caller
 * Author
 * Note
 ******************************************************************************/
 unsigned long RFRemoteDecode_GetAddr  ( unsigned short * RFRemoteBuff){
 
     unsigned short i;
     unsigned long Ret = 0 ;

     for( i = 0 ; i < 8 ; i++){
     
         if      (RFRemoteBuff [i] == RFTransceiver_BIT_0)         Ret = (unsigned long)( Ret *10 + 0) ;
         else if (RFRemoteBuff [i] == RFTransceiver_BIT_1)         Ret = (unsigned long)( Ret *10  + 1 );
         else if (RFRemoteBuff [i] == RFTransceiver_BIT_F)         Ret = (unsigned long)( Ret *10  + 2 );
         else                                                      Ret = (unsigned long)( Ret *10  + 3 );
     }
     return Ret ;
 }
   /*****************************************************************************
 *                         RFRemoteDecode_GetData()
 * Description    :
 * Argument       :
 * Return
 * Caller
 * Author
 * Note
 ******************************************************************************/
 unsigned int RFRemoteDecode_GetData ( unsigned short * RFRemoteBuff){
     
     unsigned int Ret = 0;
     unsigned short i;
     for( i = 8 ; i < 12 ; i++){
         if      (RFRemoteBuff [i] == RFTransceiver_BIT_0)         Ret = (unsigned int)( Ret *10  + 0) ;
         else if (RFRemoteBuff [i] == RFTransceiver_BIT_1)         Ret = (unsigned int)( Ret *10  + 1 );
         else if (RFRemoteBuff [i] == RFTransceiver_BIT_F)         Ret = (unsigned int)( Ret *10  + 2 );
         else                                                      Ret = (unsigned int)( Ret *10  + 3 );
     }
     return Ret ;
 
 }
/* End of file*/